<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>加减计数器</title>
    <link href="./index.css" rel="stylesheet" />
    <!-- 2.开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
</head>

<body>
    <!-- 1.html结构 -->
    <div id="app">
        <!-- 计数器功能区 -->
        <div class="input-num">
            <button @click="decrease">-</button>
            <span>{{ count }}</span>
            <button @click="increase">+</button>
        </div>
    </div>
    <!-- 3.创建Vue实例 -->
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                count: 0
            },
            methods: {
                increase() {
                    this.count++;
                },
                decrease() {
                    this.count--;
                }
            }
        })
    </script>
</body>

</html>